package org.dromara.iot.enums;

import lombok.Getter;

/**
 * 电梯运行方向枚举
 */
@Getter
public enum ElevatorDirectionEnum {
    UP(0, "上行"),
    DOWN(1, "下行"),
    STOP(2, "静止");

    private final int code;
    private final String description;

    ElevatorDirectionEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static ElevatorDirectionEnum getByCode(int code) {
        for (ElevatorDirectionEnum direction : values()) {
            if (direction.code == code) {
                return direction;
            }
        }
        return null;
    }
}